package javaIO;

import java.nio.charset.Charset;
import java.util.Iterator;
import java.util.SortedMap;

public class AvaliableCharSets {
    public static void main(String[] args){
        SortedMap<String,Charset> charsets = Charset.availableCharsets();
        Iterator<String> ite = charsets.keySet().iterator();
        while (ite.hasNext()){
            String csName = ite.next();
            System.out.print(csName);
            Iterator aliases = charsets.get(csName).aliases().iterator();
            if (aliases.hasNext()){
                System.out.print(": ");
            }
            while (aliases.hasNext()){
                System.out.print(aliases.next());
                if (aliases.hasNext()){
                    System.out.print(",");
                }
            }
            System.out.println();
        }
    }
}
